package profile.hujia.simulation.data;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import profile.hujia.simulation.data.common.CommonFunction;
import profile.hujia.simulation.data.common.ExcelFile;
import profile.hujia.simulation.data.config.SystemConfig;
import profile.hujia.simulation.data.domain.SingleBusinessLabelArg;
import profile.hujia.simulation.data.domain.SingleLabelArg;
import profile.hujia.simulation.data.service.*;

import java.util.ArrayList;
import java.util.List;

@SpringBootApplication
@Slf4j
public class SimulationDataApplication {

    public static void main(String[] args) {
        SpringApplication.run(SimulationDataApplication.class, args);
        ExcelFile excelFile = new ExcelFile();
        excelFile.init();

        SingleLabelArg singleLabelArg = new SingleLabelArg();
        SingleBusinessLabelArg singleBusinessLabelArg = new SingleBusinessLabelArg();

        BusinessQueue businessQueue = new BusinessQueue(singleLabelArg, singleBusinessLabelArg);

        GeneratePerson generatePerson = new GeneratePerson(businessQueue, singleLabelArg, singleBusinessLabelArg);
        generatePerson.run();

        DataSaveToExcel dataSaveToExcel = new DataSaveToExcel(generatePerson.getPersons(), excelFile);
        dataSaveToExcel.run();

        CapacityData capacityData = new CapacityData(generatePerson.getPersons(), excelFile);
        capacityData.run();


        List<String> conditions = new ArrayList<>();
        conditions.add("Experience-high,Education-博士,Insurance-有");
        conditions.add("Experience-middle,Education-本科");
        conditions.add("Experience-middle");
        conditions.add("1~Ability-middle");
        for (int i = 0; i < SystemConfig.TOTAL_BUSINESS_TYPE; ++i) {
            conditions.add(String.format("%d~Ability-middle,%d~Accuracy-middle,Experience-middle", i + 1, i + 1));
        }
        for (int i = 0; i < SystemConfig.TOTAL_BUSINESS_TYPE; ++i) {
            conditions.add((i + 1) + "~Ability-middle,Experience-middle");
        }
        businessQueue.intersection(conditions);

        excelFile.close();

    }

}
